import {Scene} from 'phaser'

export class LoadingScene extends Scene {
  constructor() {
    super('loading-scene')
  }

  init():void {}

  preload():void {
    this.load.baseURL = 'assets/';

    //PLAYER LOADING - 加载精灵图和json
    this.load.image('king', 'sprites/king.png'); //加载单个主角
    this.load.atlas('a-king', 'spritesheets/a-king_withmask.png', 'spritesheets/a-king_atlas.json');//加载戴口罩的主角纹理图集
    this.load.atlas('lizard', 'spritesheets/lizard.png', 'spritesheets/lizard.json'); //加载怪物纹理图集

    // MAP LOADING
    this.load.image({
      key: 'Grass',
      url: 'tilemaps/json/Grass.png',
    })//加载响应瓦片图集

    // this.load.tilemapTiledJSON(‘’)
    this.load.tilemapTiledJSON('tilemapGrass','tilemaps/json/Grass.json') //加载瓦片地图

    this.load.spritesheet('water', 'spritesheets/Water.png', {
      frameWidth: 64,
      frameHeight: 16
    });

    this.load.spritesheet("food", "spritesheets/food.png", {
      frameWidth: 32,
      frameHeight: 32
    })
  }

  create():void {
    this.scene.start('game-scene',{
      name:"Level-1"
    });//场景切换和数据传递

    this.scene.start('ui-scene',{
      name:"Level-1"
    })

    // this.add.sprite(100, 100, 'king');
  }

  update():void {}
}
